<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const list = [{
                "id": 0,
                "type": 1,
                "children": [{
                    "id": "0-1",
                    "type": 1,
                    "children": [{
                        "id": 0,
                        "type": 1,
                        "children": []
                    }]
                }]
            },
            {
                "id": 1,
                "type": 1,
                "children": [{
                    "id": "1-0",
                    "type": 1,
                    "children": []
                }]
            }, {
                "id": 2,
                "type": 0,
                "children": [{
                    "id": "2-0",
                    "type": 1,
                    "children": []
                }, {
                    "id": "2-1",
                    "type": 1,
                    "children": []
                }, {
                    "id": "2-2",
                    "type": 0,
                    "children": [{
                        "id": "2-2-0",
                        "type": 1,
                        "children": []
                    }]
                }, {
                    "id": "2-3",
                    "type": 0,
                    "children": []
                }]

            }
        ]

        function getList(list) {
            for (let i = 0; i < list.length; i++) {
                const item = list[i]
                if (item.type == 0) {
                    list.splice(i, 1)
                    i--
                }
                if (item.children && item.children.length > 0) {
                    getList(item.children)
                }
            }
        }
        getList(list)
        console.log(list)
    </script>
</body>

</html>